<template>
  <div>
    <div>
      <van-nav-bar title="我的地址" left-text="返回" left-arrow @click-left="onClickLeft" :fixed="true" />
    </div>
    <div class="container">
      <div>
        <van-address-list v-model="chosenAddressId" :list="list" @add="onAdd" @edit="onEdit" />
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "addr",
  data() {
    return {
      title: "我的地址",
      chosenAddressId: "1",
      list: [
        {
          id: "1",
          name: "张三",
          tel: "13000000000",
          address: "浙江省杭州市西湖区文三路 138 号东方通信大厦 7 楼 501 室"
        }
      ]
    };
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1);
    },
    onAdd() {
      //Toast("新增地址");
      this.$router.push('/edit')
    },

    onEdit(item, index) {
      Toast("编辑地址:" + index);
    }
  },

  mounted() {
    this.$emit("toparent", this.title);
  }
};
</script>

<style scoped>
.container {
  margin-top: 46px;
}
</style>